package com.combining.f_observer.impl;

import com.combining.f_observer.face.Observer;
import com.combining.f_observer.face.Quackable;

public class MallardDuck implements Quackable {
	Observable observable;

	public MallardDuck() {
		observable = new Observable(this);
	}

	public void quack() {
		System.out.println("绿头鸭呱呱叫");
		notifyObservers();
	}

	public void registerObserver(Observer observer) {
		observable.registerObserver(observer);
	}

	public void notifyObservers() {
		observable.notifyObservers();
	}

	public String toString() {
		return "绿头鸭";
	}
}
